var hoverZoomPlugins = hoverZoomPlugins || [];
hoverZoomPlugins.push( {
	name: 'TibiaFriends',
	version: '0.1',
	prepareImgLinks: function(callback) {
		var res = [];
		$("a img[src*=http://tibiafriends.com/pg/photos/thumbnail]").each(function() {
			var link = $(this).parents('a:eq(0)');
			if (link) {
				$(link).data('hoverZoomSrc', [this.src.match(/(.*?)\/small\//i)[1]+'/large/']);
				$(link).data('hoverZoomCaption', this.alt);
				res.push(link);
			}
		});
		$("a img[src*=http://tibiafriends.com/mod/profile/icondirect.php]").each(function() {
			var link = $(this).parents('a:eq(0)');
			if (link) {
				$(link).data('hoverZoomSrc', [this.src.match(/(.*?)&size=/i)[1]+'&size=large']);
				if(this.alt && this.alt.length > 0)
					$(link).data('hoverZoomCaption', this.alt);
				else $(link).data('hoverZoomCaption', $(link).attr('href').match(/.*?\/profile\/(.*?)$/i)[1]);
				res.push(link);
			}
		});
		$("a img.tidypics_frontpage").each(function() {
			var link = $(this).parents('a:eq(0)');
			if (link) {
				var id = this.src.match(/.*?=(\d*?)$/)[1];
				$(link).data('hoverZoomSrc', ['http://tibiafriends.com/pg/photos/thumbnail/' + id + '/large/']);
				res.push(link);
			}
		});
		callback($(res));
	}
});